﻿<UserControl x:Class="Cratos.Generator.CratosProjectView"
						 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
						 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
						 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
						 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
						 xmlns:local="clr-namespace:Cratos.Generator"
						 mc:Ignorable="d">
	<UserControl.CommandBindings>
		<CommandBinding Command="{x:Static local:CratosProjectView.ModifyCommand}" Executed="OnModifyCommandExecuted"/>
		<CommandBinding Command="{x:Static local:CratosProjectView.DeleteCommand}" Executed="OnDeleteCommandExecuted" />

		<CommandBinding Command="{x:Static local:CratosProjectView.SaveCommand}" Executed="OnSaveCommandExecuted" />
		<CommandBinding Command="{x:Static local:CratosProjectView.CancelCommand}" Executed="OnCancelCommandExecuted" />
	</UserControl.CommandBindings>

	<DockPanel>
		<GroupBox BorderBrush="{StaticResource lightBlueBrush}">
			<GroupBox.Header>
				<Border Background="{StaticResource lightBlueBrush}" Style="{StaticResource groupBoxHeader}">
					<TextBlock Text="Project Details" />
				</Border>
			</GroupBox.Header>

			<StackPanel>
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="200" />
					</Grid.ColumnDefinitions>

					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>

					<Label Grid.Row="0" Grid.Column="0" Content="Project Name:" Target="{Binding ElementName=m_TxtProjectName}"/>
					<TextBox x:Name="m_TxtProjectName" Grid.Row="0" Grid.Column="1" Width="200" 
							 Text="{Binding Path=Project.Name, Mode=TwoWay}" IsEnabled="{Binding IsInEdit}"/>
				</Grid>

				<StackPanel DockPanel.Dock="Bottom" Style="{StaticResource buttonPanel}">
					<Button Style="{StaticResource crudButton}" Command="{x:Static local:CratosProjectView.ModifyCommand}" IsEnabled="{Binding CanModify}">
						<StackPanel Orientation="Horizontal">
							<Image Source="../Images/application_edit.png" Margin="0 1 1 0" Height="20" />
							<TextBlock Text="Modify" Margin="0 1" Padding="2" FontWeight="Bold" Name="ModifyTextBlock"/>
						</StackPanel>
					</Button>
					<Button Style="{StaticResource crudButton}" Command="{x:Static local:CratosProjectView.DeleteCommand}" IsEnabled="{Binding CanDelete}">
						<StackPanel Orientation="Horizontal">
							<Image Source="../Images/delete.png" Margin="0 1 1 0" Height="20" />
							<TextBlock Text="Delete" Margin="0 1" Padding="2" FontWeight="Bold" />
						</StackPanel>
					</Button>
					<Button Style="{StaticResource crudButton}" Command="{x:Static local:CratosProjectView.SaveCommand}" IsEnabled="{Binding IsInEdit}">
						<StackPanel Orientation="Horizontal">
							<Image Source="../Images/save.png" Margin="0 1 1 0" Height="20" />
							<TextBlock Text="Save" Margin="0 1" Padding="2" FontWeight="Bold" />
						</StackPanel>
					</Button>
					<Button Style="{StaticResource crudButton}" Command="{x:Static local:CratosProjectView.CancelCommand}" IsEnabled="{Binding IsInEdit}">
						<StackPanel Orientation="Horizontal">
							<Image Source="../Images/Cancel.png" Margin="0 1 1 0" Height="20" />
							<TextBlock Text="Cancel" Margin="0 1" Padding="2" FontWeight="Bold" />
						</StackPanel>
					</Button>
				</StackPanel>
			</StackPanel>
		</GroupBox>
	</DockPanel>
</UserControl>
